<?php
/**
 * Routes configuration
 *
 * In this file, you set up routes to your controllers and their actions.
 * Routes are very important mechanism that allows you to freely connect
 * different urls to chosen controllers and their actions (functions).
 *
 * PHP 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */

// FORUM

	Router::connect('/', array('controller' => 'threads', 'action' => 'home'));
	Router::connect('/forum/*', array('controller' => 'forums', 'action' => 'displayForums'));
	Router::connect('/setHome/:id',
		array('controller' => 'threads', 'action' => 'setHome'),
		array(
			'pass' => array('id'),
			'id' => '[0-9]+'

		)
	);
	Router::connect('/newthread/:id-:slug',
		array('controller' => 'threads', 'action' => 'add'),
		array(
			'pass' => array('id', 'slug'),
			'id' => '[0-9]+'
		)
	);

	Router::connect('/postreply/:parentId-:quoteId-:slug',
		array('controller' => 'threads', 'action' => 'reply'),
		array(
			'pass' => array('parentId', 'quoteId', 'slug'),
			'parentId' => '[0-9]+',
			'quoteId' => '[0-9]+'
		)
	);

	Router::connect('/thread/:id-:slug/*',
	array('controller' => 'threads', 'action' => 'view'),
		array(
			'pass' => array('id', 'slug'),
			'id' => '[0-9]+'
		)
	);

	Router::connect('/sticky/:id-:slug/*',
		array('controller' => 'threads', 'action' => 'sticky'),
		array(
			'pass' => array('id', 'slug'),
			'id' => '[0-9]+'
		)
	);

	Router::connect('/lock/:id-:slug/*',
		array('controller' => 'threads', 'action' => 'lock'),
		array(
			'pass' => array('id', 'slug'),
			'id' => '[0-9]+'
		)
	);


	Router::connect('/editthread/:id-:slug/*',
		array('controller' => 'threads', 'action' => 'edit'),
		array(
			'pass' => array('id', 'slug'),
			'id' => '[0-9]+'
		)
	);

	Router::connect('/search/*',
		array('controller' => 'threads', 'action' => 'search')
	);

	Router::connect('/topics/:id-:slug/*',
		array('controller' => 'subForums', 'action' => 'displayTopics'),
		array(
			'pass' => array('id', 'slug'),
			'id' => '[0-9]+'
		)
	);



// NOTIFICATIONS
	Router::connect('/notifications/unsubscribe/:id-:token',
		array('controller' => 'notifications', 'action' => 'unsubscribe'),
		array(
			'pass' => array('id', 'token'),
			'id' => '[0-9]+'
		)
	);


// MESSAGES
	Router::connect('/messages/send/:user_id-:username',
		array('controller' => 'messages', 'action' => 'send'),
		array(
			'pass' => array('user_id', 'username'),
			'user_id' => '[0-9]+'
		)
	);


// USERS

	Router::connect('/users/resetPassword/:id-:token',
		array('controller' => 'users', 'action' => 'resetPassword'),
		array(
			'pass' => array('id', 'token'),
			'id' => '[0-9]+'
		)
	);

	Router::connect('/profile/:user',
		array('controller' => 'users', 'action' => 'profile'),
		array(
			'pass' => array('user')
		)
	);

	Router::connect('/users/unlock/:id-:lockcode',
		array('controller' => 'users', 'action' => 'unlock'),
		array(
			'pass' => array('id', 'lockcode'),
			'id' => '[0-9]+'
		)
	);
/**
 * ...and connect the rest of 'Pages' controller's urls.
 */


/**
 * Load all plugin routes.  See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
 */
	CakePlugin::routes();

/**
 * Load the CakePHP default routes. Remove this if you do not want to use
 * the built-in default routes.
 */
	require CAKE . 'Config' . DS . 'routes.php';
